package org.bookshare.document.packager;

import org.bookshare.document.beans.DocumentType;

/**
 * Maps document types to packagers.
 * @author Reuben Firmin
 */
public final class PackagerRegistry {

	private static final PackagerRegistry INSTANCE = new PackagerRegistry();

	/**
	 * Default constructor.
	 */
	private PackagerRegistry() {
	}

	/**
	 * Get the instance of the registry.
	 * @return never null
	 */
	public static PackagerRegistry getInstance() {
		return INSTANCE;
	}

	/**
	 * Get a packager for the given type of documents.
	 * @param type The type of documents
	 * @return Null if the type doesn't have a packager associated with it.
	 */
	public Packager getPackager(final DocumentType type) {
		// simplistic implementation, since we don't support multiple outputs.
		if (type.equals(DocumentType.DAISY)) {
			return new ZipDocumentPackager<DocumentType.DAISY>();
		}
		return null;
	}
}
